const UPWjson = [
  {
    callback(data) {
      let r = [
        { value: 'b_dl', label: '显示电量' },
        { value: 'b_jrsl', label: '今日收入' },
        {
          value: 'b_zsl',
          label: '总收入',
          if: {
            zhierror: [{ value: 'utype', zhi: ['20'] }],
          },
        },
        { value: 'b_card', label: '显示卡' },
        { value: 'b_msg', label: '显示消息' },
        {
          value: 'b_cardxn',
          label: '显示虚拟卡',
          if: {
            zhierror: [{ value: 'utype', zhi: ['20'] }],
          },
        },
        {
          value: 'b_cardcz',
          label: '给卡充值',
          if: {
            zhierror: [{ value: 'utype', zhi: ['20'] }],
          },
        },
        { value: 'b_sbedt', label: '编辑设备' },
        { value: 'b_sbdel', label: '删除设备' },

        {
          value: 'b_tjcd',
          label: '充电记录',
          if: {
            zhierror: [{ value: 'utype', zhi: ['20'] }],
          },
        },
        {
          value: 'b_tjcw',
          label: '收入统计',
          if: {
            zhi: [{ value: 'utype', zhi: ['0', 18, 19, '20'] }],
          },
        },
        {
          value: 'b_tjzz',
          label: '转账统计',
          if: {
            zhierror: [{ value: 'utype', zhi: ['20'] }],
          },
        },
        {
          value: 'b_user',
          label: '用户列表',
          if: {
            zhierror: [{ value: 'utype', zhi: ['18', '20'] }],
          },
        },

        {
          value: 'b_fr',
          label: '分润权限',
          if: {
            zhi: [{ value: 'utype', zhi: [0, 19, '18'] }],
          },
        },
        {
          value: 'b_llf',
          label: '流量费权限',
          if: {
            zhi: [{ value: 'utype', zhi: [0, 19, '18'] }],
          },
        },
        { value: 'b_tjccz', label: '卡充值统计' },
        { value: 'b_rsrtj', label: '日收入统计' },
        {
          value: 'b_rzfck',
          label: '日租费支出',
          if: {
            zhi: [{ value: 'utype', zhi: [20, 19, '18'] }],
          },
        },
        {
          value: 'b_cdcx',
          label: '充电查询',
          if: {
            zhi: [{ value: 'utype', zhi: [20, 19, '18'] }],
          },
        },
        {
          value: 'b_tjcw',
          label: '站点流水',
          if: {
            zhi: [{ value: 'utype', zhi: [0, 18, 19, '20'] }],
          },
        },
      ]

      if (data.utype == 18 && (!data.frid || data.frid == '0')) {
        r.push({ value: 'b_ckls', label: '历史数据' })
      }
      r.forEach((e) => {
        e.type = 'switch'
        // e.span = 8
      })
      return r
    },
  },
]
export function UPWdefaultvaluefn(data) {
  let r = {},
    upws = [
      'b_dl',
      'b_jrsl',
      'b_zsl',
      'b_card',
      'b_msg',
      'b_cardxn',
      'b_cardcz',
      'b_sbedt',
      'b_sbdel',
      'b_tjcd',
      'b_tjcw',
      'b_tjzz',
      'b_user',
      'b_fr',
      'b_llf',
      'b_tjccz',
      'b_rsrtj',
      'b_rzfck',
      'b_cdcx',
      'b_ckls',
    ],
    mrupw = []
  if (data.utype == '19' || data.utype == '20') {
    mrupw =
      data.utype == '19'
        ? ['b_dl', 'b_jrsl', 'b_card', 'b_msg', 'b_cardxn', 'b_tjcw', 'b_tjccz']
        : ['b_jrsl', 'b_card', 'b_msg', 'b_tjcw']
    upws.forEach((e) => {
      let falg = mrupw.find((f) => {
        return e == f
      })
      r[e] = falg ? '1' : '0'
    })
  } else {
    mrupw =
      data.utype == '18'
        ? ['b_user', 'b_llf', 'b_ckls', 'b_rzfck', 'b_rsrtj']
        : ['b_rsrtj']
    upws.forEach((e) => {
      let falg = mrupw.find((f) => {
        return e == f
      })
      r[e] = falg ? '0' : '1'
    })
  }
  return r
}

export default { UPWjson, UPWdefaultvaluefn }
